home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
NOVA - For the NeXT Workstation
/
NOVA - For the NeXT Workstation.iso
/
SourceCode
/
AdobeExamples
/
NX_ImportAdv
/
ResourcePanel.m
< prev
next >
Wrap
Text File
|
1992-12-19
|
4KB
|
189 lines
/*
* (a) (C) 1990 by Adobe Systems Incorporated. All rights reserved.
*
* (b) If this Sample Code is distributed as part of the Display PostScript
* System Software Development Kit from Adobe Systems Incorporated,
* then this copy is designated as Development Software and its use is
* subject to the terms of the License Agreement attached to such Kit.
*
* (c) If this Sample Code is distributed independently, then the following
* terms apply:
*
* (d) This file may be freely copied and redistributed as long as:
* 1) Parts (a), (d), (e) and (f) continue to be included in the file,
* 2) If the file has been modified in any way, a notice of such
* modification is conspicuously indicated.
*
* (e) PostScript, Display PostScript, and Adobe are registered trademarks of
* Adobe Systems Incorporated.
*
* (f) THE INFORMATION BELOW IS FURNISHED AS IS, IS SUBJECT TO
* CHANGE WITHOUT NOTICE, AND SHOULD NOT BE CONSTRUED
* AS A COMMITMENT BY ADOBE SYSTEMS INCORPORATED.
* ADOBE SYSTEMS INCORPORATED ASSUMES NO RESPONSIBILITY
* OR LIABILITY FOR ANY ERRORS OR INACCURACIES, MAKES NO
* WARRANTY OF ANY KIND (EXPRESS, IMPLIED OR STATUTORY)
* WITH RESPECT TO THIS INFORMATION, AND EXPRESSLY
* DISCLAIMS ANY AND ALL WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR PARTICULAR PURPOSES AND NONINFRINGEMENT
* OF THIRD PARTY RIGHTS.
*/
/*
* ResourcePanel.m
*
* This panel displays the unavailable resources.
*
* Version: 2.0
* Author: Ken Fromm
* History:
* 03-07-91 Added this comment.
*/
#import "ResourcePanel.h"
#import <appkit/Application.h>
#import <appkit/NXBrowser.h>
#import <appkit/NXBrowserCell.h>
#import <appkit/Matrix.h>
#import <objc/List.h>
#import <strings.h>
@implementation ResourcePanel
- setTypeBrowser:anObject
{
typeBrowser = anObject;
[typeBrowser useScrollBars:NO];
[typeBrowser setDelegate:self];
[typeBrowser setTarget:self];
[typeBrowser setAction:@selector(browserAction:)];
return self;
}
- setFileBrowser:anObject
{
fileBrowser = anObject;
[fileBrowser setDelegate:self];
return self;
}
- browserAction:sender
{
[fileBrowser reloadColumn:0];
return self;
}
- (int) runModalWithList:(ResourceList *) aList
{
return [self runModalWithList:aList andName:NULL];
}
- (int) runModalWithList:(ResourceList *) aList andName:(NXAtom) name
{
int result;
const char *filename;
list = aList;
if (name)
{
filename = strrchr(name, '/');
if (filename)
filename++;
else
filename = name;
[nameField setStringValue:filename];
}
else
[nameField setStringValue:"<filename unavailable>"];
[typeBrowser reloadColumn:0];
[[typeBrowser matrixInColumn:0] selectCellAt:0 :0];
[fileBrowser reloadColumn:0];
[self makeKeyAndOrderFront:self];
result = [NXApp runModalFor:self];
[self orderOut:self];
list = NULL;
return result;
}
- endModal:sender
{
[NXApp stopModal:[sender selectedTag]];
return self;
}
/*
* NXBrowser Delegate method.
*/
- (int) browser:sender fillMatrix:matrix inColumn:(int) column
{
id cell;
int i, j, row, rows, count;
const char *type;
rows = 0;
if (list)
{
if (sender == typeBrowser && column == 0)
{
for (i = 0; i < RES_NUMTYPES; i++)
{
count = [list->types[i] count];
if (count)
{
type = GetTypeComment(i);
[matrix addRow];
cell = [matrix cellAt:rows++ :0];
[cell setStringValueNoCopy:type];
[[cell setLeaf:YES] setLoaded:YES];
}
}
}
else if (sender == fileBrowser && column == 0)
{
count = 0;
row = [[typeBrowser matrixInColumn:0] selectedRow];
for (i = 0; i < RES_NUMTYPES; i++)
{
if (list->types[i])
{
if (count == row)
break;
count++;
}
}
if (i < RES_NUMTYPES)
{
count = [list->types[i] count];
for (j = 0; j < count; j++)
{
[matrix addRow];
cell = [matrix cellAt:rows++ :0];
[cell setStringValueNoCopy:(const char *) [list->types[i] objectAt:j]];
[[[cell setLeaf:YES] setLoaded:YES] setSelectable:NO];
}
}
}
}
return rows;
}
@end